#ifndef NAMEINDEX_H
#define NAMEINDEX_H

#include "ui_nameindexdialog.h"
#include <database/databasemanager.h>
#include <QtGui>
#include <QtCore>
#include <QtSql>

using namespace Common;
class NameIndex : public QDialog,public Ui::NameIndexDialog {
  Q_OBJECT
  enum Wh
  {
      NI_WEIGHT = 0,
      NI_HEIGHT
      };
  public :
      NameIndex();
      ~NameIndex();
      //QList<QMultiMap<int,QString> > nameindexMapDatas();
      //QStringList nameindexListDatas();
      //bool nameExists();
      QStandardItemModel * getModelOfValues();
      //QHash<QString,QString> getHashOfNonEmptyWeights();
      //DatabaseManager * m_surveyDatabase;
      QSqlDatabase m_db;
  private slots :
      void nameisChosen(const QString & filter);
      void addValues();
      void addNameRow();
      void fillTableWithTableviewChoice(const QModelIndex& index);
      void showWeightAndHeightDatas();
      void displayAllNames();
      void deleteName();
  private :
      QString getPatientUuid(QString & name, QString & firstname ,QString & dateOfBirth);
      //bool setNewPatientDatas();
      bool createNameModel();
      void showView();
      QHash<QString,QString> m_hashOfNonEmptyWeightValues;
      
      QSqlTableModel * m_modelNames;
      QSqlTableModel * m_modelDatas;      
};
#endif
